%% Setup
% Information Structure
Info            =   struct();
Info.FixedParam =   struct('RHO_M_ext',0.81);
Info.ParamList  =   {'RHO_M_dom','RHO_Y_H',...
                     'Taylor_Pi','Taylor_ir','Cons_Elas','Fin_AdjCost','CapAdjCost' ...
                     ...'Cons_ElasTN','Cons_ElasHF'
                     };

Info.ParamNum   =   length(Info.ParamList);

Info.StdVec     =   [1 1 1 -1 -1 60 -10]'*0.01/4;
Info.Mom_Data   =   [1;-1;-0.9;-0.3;...
                     -3/1.2;10/1.2;...
                     5];
Info.Weight     =   [10;10;10;10;...
                     1;1;...
                     10];
% Optimization 
ParaVec_0       =   [0.75;0.75;1.2;0.50;3;2.5;1];               
lb              =   [0.50;0.25;1.1;0.00;1;0.01;0];
ub              =   [0.90;0.75;1.2;0.95;10;10;10];

ObjFunction     =   @(Input)SubFun_Calibration_Eval(PP,SS,MODEL,EquJac,Info,Input);


%% Global Optimization
warning('off','all');

%--------------------------------------------------------------------------
% Particle Swarm
%--------------------------------------------------------------------------
rng default
options             =   optimoptions('particleswarm',...
                                     'Display','iter',...'SwarmSize',100.'HybridFcn',@fmincon,..
                                     'MaxTime',60*60*2,'UseParallel',true);
[ParamVec,fval,exitflag] ...
                    =   particleswarm(ObjFunction,length(lb),lb,ub,options);

[~,Mom_Model]       =   ObjFunction(ParamVec);

save('Result_1_Calibration.mat','Info','Mom_Model','ParamVec');